1. Field of the Invention
The present invention relates to read-only-memory (ROM) flashing, and more particularly to a method for flashing Extended System Configuration Data (ESCD) and variables into a ROM of a computer system.
2. Description of the Related Art
In order to support the automatic configuration of Plug and Play devices on platforms that include a standard expansion bus, non-volatile storage such as CMOS RAM, ROM, or NVRAM is used to store information about system resources used by non-Plug and Play devices in a computer system. This configuration information is typically stored in an Extended System Configuration Data (ESCD) format. The ESCD format accommodates storage of configuration information for Plug and Play devices and non-Plug and Play devices. ESCD generally allows Plug and Play System Basic Input Output Services (BIOS) code to more fully configure a computer system at power up by specifying the system resources assigned to devices that have been installed in the system. The portion of non-volatile storage used to store the ESCD may be only a subset of the total non-volatile storage available in a computer system.
System BIOS code is used by the operating system to read or write ESCD as the non-volatile storage storing ESCD has traditionally resided in the system BIOS memory space. Accordingly, only system BIOS has known the location of the ESCD in the non-volatile storage and the proper method for accessing the non-volatile storage. If the non-volatile storage is memory-mapped, the physical base address of the memory mapped non-volatile storage allows a xe2x80x9ccaller,xe2x80x9d such as an operating system, to construct a segment descriptor pointed to by a memory pointer known as a segment selector. If a function to read or write ESCD is called from a protected mode, the segment descriptor is created from a protected mode base segment address typically termed an ESCD Selector parameter. If a function to read or write ESCD is called from real mode, a segment descriptor is created from a real mode base segment address typically termed a BIOS Selector parameter. A segment selector serves as a pointer to a segment descriptor for an ESCD area of non-volatile storage. In addition, a function to read or write ESCD generates a pointer to the size of ESCD for determining an entry point into the ESCD. A function to read ESCD transfers ESCD from an ESCD area of non-volatile storage to a memory buffer typically having a pointer termed ESCD Buffer, and a function to write ESCD transfers data from the memory buffer to an ESCD area of non-volatile storage. ESCD functions are further described in the Extended System Configuration Data Specification, Version 1.02, published on Feb. 14, 1994, by Compaq Computer Corporation, Intel Corporation, and Phoenix Technologies, Ltd.
ESCD may be updated during a Power-On-Self-Test (POST) or at runtime. For example, ESCD may be updated by POST if POST detects that a new Plug and Play bootable device is added to the computer system. ESCD information may be used by POST to allocate system resources to all configurable devices that are known to the system BIOS. System resources typically include Direct Memory Access (DMA) channels, Interrupt Request Lines (IRQ""s), Input/Output (I/O) addresses, and memory. ESCD also may be updated during runtime by system software in order to effect configuration of devices on the next boot. An ESCD interface provides a mechanism for allowing system software to lock system resources allocated to specific devices in the system and thereby avoid system resource conflicts.
Updating ESCD in a conventional computer system has been dependent upon a segment selector from an operating system. The segment selector used by system BIOS to address an ESCD area of non-volatile storage is generated by the operating system. As a segment selector is exclusively configured for the memory map of the operating system, a segment selector loses meaning outside the context of the operating system memory map. A segment selector provided by an operating system also must be configured for the particular operating modexe2x80x94real mode, 16-bit protected mode, or 32-bit protected modexe2x80x94whichever is applicable. The segment selector in one operating mode is therefore different from the segment selector for another operating mode. Further, the need for a segment selector from an operating system to update ESCD has required a different selector if an ESCD area is relocated. Another drawback of using a segment selector from an operating system to read or write ESCD is the need to use a relatively slow bus within a computer system to reach the ESCD area of non-volatile storage.
ESCD has typically resided in a portion of a ROM treated as an option ROM. Option ROM represents a designated area of ROM space which an operating system preferably is programmed not to utilize. In certain operating modes, however, availability of an option ROM is not guaranteed. For example, during runtime in a 32-bit protected mode, an operating system may not provide a segment selector to an option ROM, thereby preventing access to the option ROM during runtime. In addition, the size of the ROM space for which an operating system provides a segment selector is limited.
Briefly, a computer system according to the present invention provides a method of flashing Extended System Configuration Data (ESCD) and variables stored with ESCD to a read-only-memory (ROM) using System Management Interrupt (SMI) code. An ESCD sector is defined in a read-only-memory for storing ESCD and associated variables. During Power-On-Self-Test (POST) code, a ROM image of the ESCD sector is copied to an ESCD original buffer and an ESCD write buffer. The ESCD original buffer and ESCD write buffer are areas of random access memory (RAM) used during POST for storing a ROM image of ESCD and associated variables. The ESCD write buffer may be updated by POST code. Following the POST operations, the contents of the ESCD write buffer are copied to an ESCD runtime buffer. The ESCD runtime buffer is a RAM area to be used during runtime for storing ESCD data and associated variables. The contents of the ESCD original buffer or the ESCD sector are compared to the contents of the ESCD runtime buffer. If the contents of the ESCD runtime buffer differ from the contents of the compared buffer or sector, SMI code flashes the ROM image in the ESCD runtime buffer to the ESCD sector. If the ESCD runtime buffer is the same as the contents of the compared buffer or sector, a ROM flash is not performed. POST is then exited and the computer system is booted.
During runtime, any write to ESCD or an associated variable is detected. If a write to ESCD or an associated variable is detected, the ESCD runtime buffer is updated with the ESCD or variable provided for the write operation. The SMI code then flashes the ROM image in the ESCD runtime buffer into the ESCD sector to save the ESCD or variable provided by the write operation.
This method of flashing ESCD and associated variables permits ESCD and associated variables to be flashed in any operating mode whether real mode, 16-bit protected mode, or 32-bit protected mode. An operating mode-specific segment selector from an operating system for locating ESCD thus is no longer needed. Another advantage of this method of flashing ESCD and associated variables is the reduced POST execution time. This advantage is achieved by using the ESCD buffers to read a ROM image during late POST and runtime rather than reading a ROM image from the ESCD sector.